﻿#ifndef SERVER_H
#define SERVER_H

#include <QObject>
#include <QTcpSocket>
#include <QTcpServer>
#include <QThread>

class ClientThread : public QThread
{
    Q_OBJECT
public:
    explicit ClientThread(QTcpSocket *socket, QObject *parent = nullptr);
    ~ClientThread();

    void run() override;

private slots:
    void onReadyRead();
    void onDisconnected();

private:
    QTcpSocket *clientSocket;
};

class Server : public QObject
{
    Q_OBJECT
public:
    Server(QObject *parent = nullptr);
    void startServer();

private slots:
    void onNewConnection();

private:
    QTcpServer *tcpServer;
};

#endif // SERVER_H
